<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateInventory extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('inventory', function (Blueprint $table) {
            $table->id();
            $table->unsignedInteger('warehouse_id')->default(0)->comment('仓库ID');
            $table->string('storage_type')->default('')->comment('入库类型');
            $table->unsignedInteger('c_id')->default(0)->comment('品类ID');
            $table->string('c_number')->default('')->comment('品类编号');
            $table->string('type')->default('')->comment('品类类型');
            $table->string('model')->default('')->comment('品类型号');
            $table->string('uom')->default('')->comment('计量单位');
            $table->decimal('sale_price', 15, 2)->default(0)->comment('销售价');
            $table->decimal('out_price', 15, 2)->default(0)->comment('出库价');
            $table->string('description')->default('')->comment('描述');
            $table->integer('inventory')->default(0)->comment('库存数量(入库数)');
            $table->integer('safe_inventory')->default(0)->comment('安全库存');
            $table->unsignedInteger('create_user_id')->default(0)->comment('创建人ID');
            $table->integer('create_time')->nullable();
            $table->integer('update_time')->nullable();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('inventory');
    }
}
